﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Universe.MediaProbe.Utils
{
    using System.IO;

    public class StreamExtentions
    {
        public static long Copy(Stream from, Stream to)
        {
            long length = 0;
            byte[] buffer = new byte[16384];
            int chunkSize;
            while ((chunkSize = from.Read(buffer, 0, buffer.Length)) > 0)
            {
                length += chunkSize;
                to.Write(buffer, 0, chunkSize);
            }

            return length;
            
        }
    }
}
